home *** CD-ROM | disk | FTP | other *** search
- //
- // Snuffy
- //
- // A silly hack that snuffs Sniffy and replaces him with a more loyal
- // companion of a sadly endangered species.
- //
- // Written at MacHack '95 in a shitty hotel in Southfield, Michigan
- //
- // © 1995 Steve Klingsporn (moofie@dogcow.com)
- //
- // Note: The dogcow image is a trademark of Apple Computer, Inc.,
- // and is used without permission. If someone at Apple wants to
- // yell and scream at me, they're welcome to -- my contact
- // information is on the name card I install in the name card file.
- //
- // Version: 1.0
- //
-
- #include "Magic.h"
- #include "Debug.h"
- #include "Package.h"
-
-
- // Constants I define for system indexicals which are curiously
- // undocumented in Indexicals.h
-
- #define iFindButtonImage MakeIndexical(6,195)
- #define iStandingLookingImage1 MakeIndexical(6,405)
- #define iStandingLookingImage2 MakeIndexical(6,406)
- #define iStandingLookingForwardImage MakeIndexical(6,407)
- #define iWalkingImage1 MakeIndexical(6,404)
- #define iWalkingImage2 MakeIndexical(6,403)
- #define iWalkingImage3 MakeIndexical(6,402)
- #define iWalkingImage4 MakeIndexical(6,401)
-
-
- // Indexicals I define for my hack-like evil things I install
-
- #define iFindButtonHackImage MakePackageIndexical(25,1)
- #define iStandingLookingHackImage1 MakePackageIndexical(25,2)
- #define iStandingLookingHackImage2 MakePackageIndexical(25,3)
- #define iStandingLookingForwardHackImage MakePackageIndexical(25,4)
- #define iWalkingHackImage1 MakePackageIndexical(25,5)
- #define iWalkingHackImage2 MakePackageIndexical(25,6)
- #define iWalkingHackImage3 MakePackageIndexical(25,7)
- #define iWalkingHackImage4 MakePackageIndexical(25,8)
- #define iSniffyDeathAnnouncement MakePackageIndexical(25,9)
-
-
- // Main stub (should not contain code)
-
- main()
- {
- }
-
-
- #undef CURRENTCLASS
- #pragma segment InstallerKibble
- #define CURRENTCLASS InstallerKibble
-
-
- //
- // Class: InstallerKibble
- //
- // Method: SnuffSniffy
- //
- // Purpose: Pops a fake Sniffy stamp out of the Magic Lamp and sends him hurling
- // into the trash. Deletes the fake Sniffy stamp from the trash so the
- // effect of him actually dying is preserved. Plays the trash
- // drum sound but does not actually empty the trash (because
- // this would be an uncool thing to do).
- //
-
- Method void InstallerKibble_SnuffSniffy(ObjectID self)
- {
- ObjectID tempSniffy;
-
- tempSniffy = New(Stamp_, nilObject); // New fake Sniffy stamp
- SetImage(tempSniffy, iStandingLookingImage2); // Set the image to Sniffy
-
- SetSuperview(tempSniffy, iMagicLampGadget); // Pop Sniffy out of the Lamp
- SetVisible(tempSniffy, true); // Necessary? Won't hurt...
- PlaySound(iConfirmSound);
-
- HopToTrash(tempSniffy); // Send him hurling into the trash
- DelayMilliseconds(1000);
-
- Destroy(tempSniffy); // Kill him
- PlaySound(iTrashSound); // Play the trash drum sound
- }
-
-
- //
- // Class: InstallerKibble
- //
- // Method: InstallInto
- //
- // Purpose: Installs our hack after calling SnuffSniffy to provide
- // an amusing animation sequence. If you want to install hacks,
- // this is one good way to do so.
- //
-
- Method void InstallerKibble_InstallInto(ObjectID self, ObjectID newObject, Unsigned flags, ObjectID parameter, ObjectID unusedObsolete)
- {
- SnuffSniffy(self); // Play untimely Sniffy death animation
-
- // Install the new images in a friendly manner so when the package
- // is packed up or unexpectedly goes away, the old system images are
- // preserved. If one were do use SetIndexical(...), when the package
- // was packed up, really evil nasty things would happen.
-
- InstallInto(iSystem, iFindButtonHackImage, 0, iFindButtonImage, nilObject);
- InstallInto(iSystem, iStandingLookingHackImage1, 0, iStandingLookingImage1, nilObject);
- InstallInto(iSystem, iStandingLookingHackImage2, 0, iStandingLookingImage2, nilObject);
- InstallInto(iSystem, iStandingLookingForwardHackImage, 0, iStandingLookingForwardImage, nilObject);
- InstallInto(iSystem, iWalkingHackImage1, 0, iWalkingImage1, nilObject);
- InstallInto(iSystem, iWalkingHackImage2, 0, iWalkingImage2, nilObject);
- InstallInto(iSystem, iWalkingHackImage3, 0, iWalkingImage3, nilObject);
- InstallInto(iSystem, iWalkingHackImage4, 0, iWalkingImage4, nilObject);
-
- // Break it to the user that their pooch is dead.
-
- Announce(iSniffyDeathAnnouncement);
-
- // Always call the inherited method.
-
- InheritedInstallInto(self, newObject, flags, parameter, unusedObsolete);
- }
-
- #undef CURRENTCLASS
-